package com.ssm.springboot.controller;

import com.ssm.springboot.pojo.DataInfo;
import com.ssm.springboot.pojo.QfClassify;
import com.ssm.springboot.service.QfClassifyService;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import java.sql.Timestamp;

/**
 * (QfClassify)表控制层
 *
 * @author makejava
 * @since 2021-12-23 19:39:22
 */
@RestController
@RequestMapping("/qfClassify")
public class QfClassifyController {
    /**
     * 服务对象
     */
    @Resource
    private QfClassifyService qfClassifyService;

    /**
     * 通过主键查询单条数据
     *
     * @param id 主键
     * @return 单条数据
     */
    @RequiresPermissions(value = {"/qfClassify/selectOne"})
    @RequestMapping("/selectOne")
    public DataInfo selectOne(Integer id) {
        return qfClassifyService.queryById(id);
    }

    @RequiresPermissions(value = {"/qfClassify/findAll"})
    @RequestMapping("/findAll")
    public DataInfo findAll(@RequestParam("page")int page, @RequestParam("limit")int limit){
        return qfClassifyService.queryAllByLimit(page,limit);
    }

    //添加课程类型
    @RequiresPermissions(value = {"/qfClassify/add"})
    @RequestMapping("/add")
    public DataInfo add(@RequestBody QfClassify qfClassify){
        return qfClassifyService.insert(qfClassify);
    }

    //删除课程类型
    @RequiresPermissions(value = {"/qfClassify/delete"})
    @RequestMapping("/delete")
    public DataInfo delete(int id){
        return qfClassifyService.deleteById(id);
    }


    //修改课程类型
    @RequiresPermissions(value = {"/qfClassify/update"})
    @RequestMapping("/update")
    public DataInfo update(@RequestBody QfClassify qfClassify){
        return qfClassifyService.update(qfClassify);
    }


}